import pygame, sys
from pygame.locals import*


pygame.init()

white = (255,255,255)
black = (0,0,0)


width, height = 400,400

screen = pygame.display.set_mode((width, height),0,32)
pygame.display.set_caption("Teste Images")


#create a surface we can draw on
background = pygame.Surface(screen.get_size())

#Fill the screen with a black background
background.fill(black)

#Before the loop, load sounds
soundStart = pygame.mixer.Sound("music.wav")

positionBackground = (0,0)

imageBack = pygame.image.load("bg2.jpg")
imageBack = pygame.transform.scale(imageBack,(400,400))
time = pygame.time.Clock()

snake = pygame.image.load("snake.png")
snake.set_colorkey(white)

block = pygame.image.load("block.png").convert()
block.set_colorkey(white)

blockPosition = block.get_rect()

while True:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			exit()
			
		if event.type == pygame.MOUSEBUTTONDOWN:
			soundStart.play()
			
	#copy the background
	screen.blit(imageBack,positionBackground)
	
	
	snakePosition = pygame.mouse.get_pos()
	x = snakePosition[0]
	y = snakePosition[1]
	
	
	blockPosition.x = 100
	blockPosition.y = 100

	#copy image to screen
	screen.blit(snake, [x,y])
	screen.blit(block, blockPosition)
	
	#time
	time.tick(20)
	
	pygame.display.flip()